class Elephant {
    into(fridge: Fridge) {
        fridge.put(this)
    }
}

class Fridge {
    status: string
    elephants: Elephant[] = []

    open() {
        this.status = "opened"
    }

    put(elephant: Elephant) {
        this.elephants.push(elephant)
    }

    close() {
        this.status = "closed"
    }
}

function main() {
    const elephant = new Elephant()
    const fridge = new Fridge()
    fridge.open()
    elephant.into(fridge)
    fridge.close()
}
